package org.jeecg.modules.qyxx.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
import org.jeecg.modules.qyxx.entity.TycQsgg;
import org.jeecg.modules.qyxx.entity.req.BgNsrjbxxReq;
import org.jeecg.modules.qyxx.entity.req.SsjcSssjDTO;
import org.jeecg.modules.qyxx.mapper.TycQsggMapper;
import org.jeecg.modules.qyxx.service.ITycQsggService;
import org.jeecg.modules.qyxx.util.DateUtils;
import org.springframework.stereotype.Service;


import java.util.ArrayList;
import java.util.List;

/**
 * @Description: 欠税公告
 * @Author: zhujianjun
 * @Date:   2022-06-20
 * @Version: V1.0
 */
@Service
public class TycQsggServiceImpl extends MppServiceImpl<TycQsggMapper, TycQsgg> implements ITycQsggService {

    @Override
    public List<TycQsgg> qsgg(SsjcSssjDTO req) {
        /*Page page = new Page<>();
        page.setPages(req.getPageNo());
        page.setSize(req.getPageSize());*/
        return baseMapper.list(req.getShxydm(),req.getTjnd());
    }

    @Override
    public List<TycQsgg> qsggBg(BgNsrjbxxReq req) {
        DateUtils utils = DateUtils.getInstance();
        String djxh = req.getDjxh();
        List<String> tjnds = utils.nearlyThreeYears(req.getKssj(), req.getJssj());
        List<TycQsgg> list = new ArrayList<>();
        for (String tjnd : tjnds) {
            List<TycQsgg> tycQsggs = baseMapper.listByDjxhAndYear(djxh, tjnd);
            list.addAll(tycQsggs);
        }
        return list;
    }
}
